import java.awt.*;

import javax.swing.*;
import javax.swing.border.LineBorder;


public class CardDrawLot extends Lot
{

	private String cardType; // either "Chance" or "CommunityChest"
	private int cardNumber; // either 1, 2, or 3 to distinguish it from other CardDrawLots of same type
	
	// Dimensions:
	private int WIDTH;			// width of the property graphic
	private int HEIGHT;			// height of the property graphic
	
	private ImageIcon imageChance; // image used for the Chance logo on the lot
	private ImageIcon imageChest; // image used for the Community Chest logo on the lot
	
	public CardDrawLot(String name, String type, String location, String cT, int cN)
	{
		super(name, type, location);
		
		cardType = cT;
		cardNumber = cN;
		
		if(location == "north" || location == "south")
		{
			WIDTH = 55;
			HEIGHT = 100;
		}
		else if(location == "east" || location == "west")
		{
			WIDTH = 100;
			HEIGHT = 55;
		}
		
		setPreferredSize(new Dimension(WIDTH, HEIGHT));
		setBorder(new LineBorder(Color.black));
		setBackground(new Color(200,222,186)); 
		//setBackground(Color.CYAN); // temporary to see the dimensions are correct
		
		if(location == "south")
		{
			//imageChance = new ImageIcon("C:/Users/Jason/javacode/MONOPOLY/logos/PinkChance_south_small.jpg");
			//imageChest = new ImageIcon("C:/Users/Jason/javacode/MONOPOLY/logos/CommChest_south_small.jpg");
			imageChance = new ImageIcon("./logos/PinkChance_south_small.jpg");
			imageChest = new ImageIcon("./logos/CommChest_south_small.jpg");
		}			
		else if(location == "north")
		{
			//imageChance = new ImageIcon("C:/Users/Jason/javacode/MONOPOLY/logos/BlueChance_north_small.jpg");
			imageChance = new ImageIcon("./logos/BlueChance_north_small.jpg");
		}
		else if(location == "east")
		{
			//imageChance = new ImageIcon("C:/Users/Jason/javacode/MONOPOLY/logos/OrangeChance_east_small.jpg");
			//imageChest = new ImageIcon("C:/Users/Jason/javacode/MONOPOLY/logos/CommChest_east_small.jpg");
			imageChance = new ImageIcon("./logos/OrangeChance_east_small.jpg");
			imageChest = new ImageIcon("./logos/CommChest_east_small.jpg");
		}
		else if(location == "west")
		{
			//imageChest = new ImageIcon("C:/Users/Jason/javacode/MONOPOLY/logos/CommChest_west_small.jpg");
			imageChest = new ImageIcon("./logos/CommChest_west_small.jpg");
		}
		
	} // end CardDrawLot constructor
	
	public String getCardType()
	{
		return cardType;
	} // end getCardType
	
	public int getCardNumber()
	{
		return cardNumber;
	} // end getCardNumber	
	
	// will actually draw the image:
	public void paintComponent(Graphics g)
	{	
		super.paintComponent(g);
		g.setColor(new Color(200,222,186));
		g.fillRect(0, 0, 55, 100);
		g.setColor(Color.black);
		
		if(location == "south")		
		{
			g.drawLine(1, 1, 55, 1);
			if(cardType == "Chance")
				imageChance.paintIcon(this, g, 2, 2);
			else if(cardType == "CommunityChest")
				imageChest.paintIcon(this, g, 2, 2);
		}
		else if(location == "north")
		{
			g.drawLine(1, 98, 55, 98);
			imageChance.paintIcon(this, g, 2, 2);
		}
		else if(location == "east")
		{
			g.drawLine(1, 1, 1, 55);
			if(cardType == "Chance")
				imageChance.paintIcon(this, g, 3, 2);
			else if(cardType == "CommunityChest")
				imageChest.paintIcon(this, g, 2, 2);
		}
		else if(location == "west")
		{
			g.drawLine(98, 0, 98, 55);
			imageChest.paintIcon(this, g, 0, 1);;
		}
			
	} // end paintComponent
	
} // end class CardDrawLot
